<script type="text/javascript" src="{lib file=jquery.min.js}" charset="utf-8"></script>
<script type="text/javascript" src="{lib file=jquery.plugins/fresco/fresco.js}" charset="utf-8"></script>
<script type="text/javascript" src="{lib file=zoom/mzp-packed.js}" charset="utf-8"></script>
<script type="text/javascript" src="{lib file=jquery.plugins/raty/jquery.raty.min.js}" charset="utf-8"></script>
<link href="{lib file=jquery.plugins/fresco/fresco.css}" rel="stylesheet" type="text/css" />
<link href="{lib file=jquery.plugins/raty/css/application.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//<!CDATA[
$(function(){
  $('#join').click(function(){
        var qty = 0;
        var error = false;
        var max_per_user = {$group.max_per_user};
        $('input[ectype="quantity"]').each(function(){
            if(parseInt($(this).val()) > 0 ){
                qty += parseInt($(this).val());
            }
            if($(this).val() !='' && (parseInt($(this).val()) < 0 || isNaN(parseInt($(this).val()))))
            {
                error = true;
            }
        });
        if('{$group.ican.login}'){
           alert('{$lang.need_login}');
           window.location.href = SITE_URL + '/index.php?app=member&act=login&ret_url=' + encodeURIComponent('index.php?app=groupbuy&id={$group.group_id}');
        }else if(error == true){
           alert('{$lang.invalid_quantity}');
        }else if(qty == 0){
           alert('{$lang.fill_quantity}');
        }else if(max_per_user > 0 && qty > max_per_user){
           alert('{sprintf lang=error_max_per_user var1=group.max_per_user}');
        }else{
            $('.step-tow').show(400);
			$('.step-one').hide();
            $('input[name="link_man"]').focus();
            $('input[ectype="quantity"]').attr('disabled',true);
        }
    });
    $('.close-btn').click(function(){
        $(this).parent('.i-want-join').hide();
        $('input[ectype="quantity"]').attr('disabled',false);
    });
    $('#join_group_form').submit(function(){
        $('input[ectype="quantity"]').attr('disabled',false);
    });
    $('input[name="exit"]').click(function(){
        if(!confirm('{$lang.confirm_exit}')){
            return false;
        }
    });
	$.each($('.countdown'),function(){
	
		var theDaysBox  = $(this).find('.NumDays');
		var theHoursBox = $(this).find('.NumHours');
		var theMinsBox  = $(this).find('.NumMins');
		var theSecsBox  = $(this).find('.NumSeconds');
		
		countdown(theDaysBox, theHoursBox, theMinsBox, theSecsBox)
	});
	$.fn.raty.defaults.path = 'static/images/';
	$('#evaluation').raty({ readOnly: true, score:{$goods.avg_g_eva|default:0}});
	//by psmoban start
	$('.tiny-pics .list li').mouseover(function(){
        $('.tiny-pics .list li').removeClass();
        $(this).addClass('pic_hover');
    });
	
	var moveNum=-62;
	var lengthLi = ($('.tiny-pics .list li').width()) * $('.tiny-pics .list li').length - 310;
	$('#forword').click(function(){
        var posleftNum = $('.tiny-pics .list').position().left;
        if($('.tiny-pics .list').position().left > -lengthLi){
            $('.tiny-pics .list').css({'left': posleftNum + moveNum});
        }
    });
	$('#backword').click(function(){
        var posleftNum = $('.tiny-pics .list').position().left;
        if($('.tiny-pics .list').position().left < 0){
            $('.tiny-pics .list').css({'left': posleftNum - moveNum});
        }
    });
})
</script>
<div class="w-shop clearfix group-info">
    <div class="zoom-pics col-sub">
        <div class="big_pic border  mb5">
            <a href="{$goods._images.0.image_url}" id="zoom" class="MagicZoom MagicThumb">
                <img src="{$goods._images.0.thumbnail|default:$default_image}" width="350"
                height="350" id="main_img" class="main_img" />
            </a>
        </div>
        <div class="tiny-pics">
            <a href="javascript:;" id="forword" class="controler">
            </a>
            <a href="javascript:;" id="backword" class="controler">
            </a>
            <ul class="list clearfix">
                <!--{foreach from=$goods._images item=goods_image name=fe_goods_image}-->
                <li {if $smarty.foreach.fe_goods_image.first}class="pic_hover" {/if}>
                    <a href="{$goods_image.image_url}" rel="zoom" rev="{$goods_image.image_url}">
                        <img src="{$goods_image.thumbnail}" />
                    </a>
                </li>
                <!--{/foreach}-->
            </ul>
        </div>
        <div class="share w-full clearfix mb10">
            <div class="view-big-imgs">
                <b>
                </b>
                <!--{foreach from=$goods._images item=goods_image name=fe_goods_image}-->
                <a href="{$goods_image.image_url}" data-fresco-group='goods_info' target="_blank"
                class="fresco {if $smarty.foreach.fe_goods_image.iteration gt 1}hidden{/if}">
                    查看大图
                </a>
                <!--{/foreach}-->
            </div>
            <div class="collect-goods">
                <a href="javascript:collect_goods({$goods.goods_id});">
                </a>
            </div>
            <div class="share-list">
                <em>
                    分享到：
                </em>
                <!-- JiaThis Button BEGIN -->
                <div class="jiathis_style" style="margin-top: 3px;">
                    <a class="jiathis_button_qzone">
                    </a>
                    <a class="jiathis_button_tsina">
                    </a>
                    <a class="jiathis_button_tqq">
                    </a>
                    <a class="jiathis_button_weixin">
                    </a>
                    <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis"
                    target="_blank">
                    </a>
                </div>
                <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js"
                charset="utf-8">
                </script>
                <!-- JiaThis Button END -->
            </div>
        </div>
    </div>
    <div class="col-main ml20 goods-attr ">
        <form method="post" id="join_group_form" action="index.php?app=groupbuy&amp;id={$group.group_id}">
            <div class="goods-name mb10">
                {$group.group_name|escape}
                <br />
            </div>
            <div class="attribute">
                <div class="attr-detail float-left">
                    <div class="rate pb10">
                        <p>
                            <span class="t">
                                商品名称{$lang.colon}
                            </span>
                            <span class="goods_name">
                                {$goods.goods_name|escape}
                            </span>
                        </p>
                        <p>
                            <span class="t">
                                商品原价{$lang.colon}
                            </span>
                            <span class="price">
                                <del style="color:#999;">{$goods.price|price}</del>
                            </span><br />

                        </p>
                         <p>
                            <span class="t">
                                团购价格{$lang.colon}
                            </span>
                            <span class="price">
                                {$group.group_price|price}
                            </span>
                        </p>
                        <p>
                            <span class="t">
                                所属品牌{$lang.colon}
                            </span>
                            <span>
                                {$goods.brand|escape}
                            </span>
                        </p>
                        <p>
                            <span class="t">
                                商品标签{$lang.colon}
                            </span>
                            &nbsp;&nbsp;
                            <!--{foreach from=$goods.tags item=tag}-->
                            {$tag}&nbsp;&nbsp;&nbsp;
                            <!--{/foreach}-->
                        </p>
                        <p>
                            <span class="t">
                                商品评分{$lang.colon}
                            </span>
                            <span id="evaluation">
                            </span>
                        </p>
                        <p>
                            <span class="t">
                                {$lang.group_desc}{$lang.colon}
                            </span>
                            <span style="width:510px;color:#999;">
                                <!-- {if $group.group_desc} -->
                                {$group.group_desc}
                                <!-- {else} -->
                                {$lang.no_desc}
                                <!-- {/if} -->
                            </span>
                        </p>
                        <!-- {if $group.max_per_user gt 0} -->
                        <p>
                            <span class="t">
                                {$lang.max_per_user}{$lang.colon}
                            </span>
                            <span>
                                {$group.max_per_user}
                            </span>
                        </p>
                        <!-- {/if} -->
                        <p>
                            <span class="t">
                                成团件数{$lang.colon}
                            </span>
                            <span>
                                <b class="inverse_proportion">
                                    <i style="width:{$group.left_per}%;">
                                    </i>
                                </b>
                            </span>
                            <span class="ml20 needed">
                                {if $group.min_quantity gt $group.quantity} {$lang.short_of}{$group.left_quantity}件
                                {else} 团购已完成&nbsp;(已订{$group.quantity}件商品) {/if}
                            </span>
                        </p>
                        <p>
                            <span class="t">
                                {$lang.region}{$lang.colon}
                            </span>
                            <span>
                                {$store.region_name|escape}
                            </span>
                        </p>
                        <!--{if $group.left_time}-->
                        <p class="countdown mt10 mb10">
                            <span class="t">
                                剩余时间{$lang.colon}
                            </span>
                            <span class="time NumDays">
                                {$group.left_time.d}
                            </span>
                            <em>
                                天
                            </em>
                            <span class="time NumHours">
                                {$group.left_time.h}
                            </span>
                            <em>
                                小时
                            </em>
                            <span class="time NumMins">
                                {$group.left_time.m}
                            </span>
                            <em>
                                分
                            </em>
                            <span class="time NumSeconds">
                                {$group.left_time.s}
                            </span>
                            <em>
                                秒
                            </em>
                        </p>
                        <!--{/if}-->
                    </div>
                    <div class="buy-btn gr-btn">
                        <div class="i-want-join step-one  hidden">
                            <div class="close-btn">
                                X
                            </div>
                            <table>
                                <tr>
                                    <th>
                                        {$goods.spec_name|escape}
                                    </th>
                                    <th>
                                        {$lang.original_price}
                                    </th>
                                    <th>
                                        {$lang.group_price}
                                    </th>
                                    <!-- {if $group.ican.join or $group.ican.join_info} -->
                                    <th style="width:70px;">
                                        {$lang.buy_quantity}
                                    </th>
                                    <!-- {/if} -->
                                </tr>
                                <!-- {foreach from=$goods._specs item=spec} -->
                                <tr>
                                    <td>
                                        {$spec.spec}
                                        <input ectype="spec" name="spec[]" type="hidden" class="text" value="{$spec.spec}"
                                        />
                                        <input ectype="spec_id" name="spec_id[]" type="hidden" class="text" value="{$spec.spec_id}"
                                        />
                                    </td>
                                    <td>
                                        {$spec.price|price}
                                    </td>
                                    <td>
                                        {$spec.group_price|price}
                                    </td>
                                    <!-- {if $group.ican.join or $group.ican.join_info} -->
                                    <td>
                                        <!-- {if $group.ican.join} -->
                                        <input style="width:70px;" ectype='quantity' name="quantity[]" type="text"
                                        class="text" />
                                        <!-- {/if} -->
                                        <!-- {if $group.ican.join_info} -->
                                        {$spec.my_qty}
                                        <!-- {/if} -->
                                    </td>
                                    <!-- {/if} -->
                                </tr>
                                <!-- {/foreach} -->
                                <tr height="20">
                                </tr>
                                <tr>
                                    <td colspan="2">
                                    </td>
                                    <td colspan="2" style="text-align:right;">
                                        <input id="join" type="button" value="确定并填写相关信息" />
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div class="i-want-join step-tow  hidden">
                            <div class="close-btn">
                                X
                            </div>
                            <table>
                                <tr>
                                    <td>
                                        <h1>
                                            {$lang.join_user_info}
                                        </h1>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">
                                        {$lang.join_tips}
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">
                                        {$lang.real_name}{$lang.colon}
                                        <input name="link_man" type="text" class="text" />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">
                                        {$lang.tel}{$lang.colon}
                                        <input name="tel" type="text" class="text" />
                                    </td>
                                </tr>
                                <tr height="50">
                                    <td colspan="2">
                                        <input name="join" style="margin-left:139px;" type="submit" value="{$lang.join_groupbuy}"
                                        />
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <!-- {if $group.ican.join} -->
                        <a onclick="$('.step-one').show(300);" class="add-to-cart btn ml10 pointer">
                            我要参加团购
                        </a>
                        <!-- {/if} -->
                        <!-- {if $group.ican.join_info} -->
                        <span class="ml10 mr10">
                            {$lang.joined_this_groupbuy}
                        </span>
                        <!-- {/if} -->
                        <!-- {if $group.ican.exit} -->
                        <input name="exit" class="btn add-to-cart input" type="submit" value="{$lang.exit_groupbuy}"
                        />
                        <!-- {/if} -->
                        <!-- {if $group.ican.buy} -->
                        <a class="buy-now btn pointer" onclick="window.location.href='index.php?app=order&goods=groupbuy&group_id={$smarty.get.id}'">
                            {$lang.buy}
                        </a>
                        <!-- {/if} -->
                        <!--{if !$group.ican.join && !$group.ican.join_info && !$group.ican.buy}-->
                        <span style="margin-left:10px;" class="buy-now btn">
                            {$group.state_desc}
                        </span>
                        <!--{/if}-->
                    </div>
                </div>
                <div class="store-info-g w210 float-right mt10">
                    <div class="store-info border mb10">
                        <h3 class="border-b">
                            <span>
                                {$store.store_name|escape}
                            </span>
                        </h3>
                        <div class="content">
                            <dl class="border-b total_evaluation w-full clearfix">
                                <dt>
                                    {$lang.all_evaluation}{$lang.colon}
                                </dt>
                                <dd>
                                    <div class="raty">
                                        <span style="width:{$store.evaluation_rate|default:0};">
                                        </span>
                                    </div>
                                    <b>
                                        {$store.avg_evaluation|default:0}
                                    </b>
                                    {$lang.fen}
                                </dd>
                            </dl>
                            <div class="rate-info">
                                <p>
                                    <strong>
                                        {$lang.store_evaluation}
                                    </strong>
                                    {$lang.compare_insdusty}
                                </p>
                                <ul>
                                    <li>
                                        {$lang.goods_evaluation}
                                        <span class="credit">
                                            {$store.avg_goods_evaluation}
                                        </span>
                                        <span class="{$store.industy_compare.goods_compare.class}">
                                            <i>
                                            </i>
                                            {$store.industy_compare.goods_compare.name}
                                            <em>
                                                <!--{if $store.industy_compare.goods_compare.value eq 0}-->
                                                ----
                                                <!--{else}-->
                                                {$store.industy_compare.goods_compare.value}%
                                                <!--{/if}-->
                                            </em>
                                        </span>
                                    </li>
                                    <li>
                                        {$lang.service_evaluation}
                                        <span class="credit">
                                            {$store.avg_service_evaluation}
                                        </span>
                                        <span class="{$store.industy_compare.service_compare.class}">
                                            <i>
                                            </i>
                                            {$store.industy_compare.service_compare.name}
                                            <em>
                                                <!--{if $store.industy_compare.service_compare.value eq 0}-->
                                                ----
                                                <!--{else}-->
                                                {$store.industy_compare.goods_compare.value}%
                                                <!--{/if}-->
                                            </em>
                                        </span>
                                    </li>
                                    <li>
                                        {$lang.shipped_evaluation}
                                        <span class="credit">
                                            {$store.avg_shipped_evaluation}
                                        </span>
                                        <span class="{$store.industy_compare.shipped_compare.class}">
                                            <i>
                                            </i>
                                            {$store.industy_compare.shipped_compare.name}
                                            <em>
                                                <!--{if $store.industy_compare.shipped_compare.value eq 0}-->
                                                ----
                                                <!--{else}-->
                                                {$store.industy_compare.shipped_compare.value}%
                                                <!--{/if}-->
                                            </em>
                                        </span>
                                    </li>
                                </ul>
                            </div>
                            <dl class="border-b contact_us dl-c-s clearfix">
                                <dt>
                                    {$lang.contact_style}{$lang.colon}
                                </dt>
                                <dd>
                                    <!--{if $store.im_qq}-->
                                    <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin={$store.im_qq|escape}&site=qq&menu=yes">
                                        <img border="0" src="http://wpa.qq.com/pa?p=1:{$store.im_qq|escape}:4"
                                        alt="点击这里给我发消息" title="点击这里给我发消息" />
                                    </a>
                                    <!--{/if}-->
                                    <!--{if $store.im_ww}-->
                                    <a target="_blank" href="http://amos.im.alisoft.com/msg.aw?v=2&uid={$store.im_ww|escape:url}&site=cntaobao&s=2&charset={$charset}">
                                        <img border="0" src="http://amos.im.alisoft.com/online.aw?v=2&uid={$store.im_ww|escape:url}&site=cntaobao&s=2&charset={$charset}"
                                        alt="Wang Wang" />
                                    </a>
                                    <!--{/if}-->
                                </dd>
                            </dl>
                            <dl class="dl-c-s w-full clearfix">
                                <dt>
                                    {$lang.store_name}{$lang.colon}
                                </dt>
                                <dd>
                                    {$store.store_name|escape}
                                </dd>
                            </dl>
                            <dl style="padding-top:2px;" class="dl-c-s w-full clearfix">
                                <dt>
                                    {$lang.credit_value}{$lang.colon}
                                </dt>
                                <dd>
                                    <!--{if $store.credit_value ge 0}-->
                                    <img src="{$store.credit_image}" alt="" align="absmiddle" />
                                    <!--{/if}-->
                                </dd>
                            </dl>
                            <!--{if $store.certifications}-->
                            <dl style="padding-top:1px;" class="dl-c-s w-full clearfix">
                                <dt style="margin-top:2px;">
                                    {$lang.certification}{$lang.colon}
                                </dt>
                                <dd>
                                    <!--{foreach from=$store.certifications item=cert}-->
                                    <!--{if $cert eq "autonym"}-->
                                    <a href="{url app=article&act=system&code=cert_autonym}" target="_blank"
                                    title="{$lang.cert_autonym}">
                                        <img src="{res file=images/cert_autonym.gif}" />
                                    </a>
                                    <!--{elseif $cert eq "material"}-->
                                    <a href="{url app=article&act=system&code=cert_material}" target="_blank"
                                    title="{$lang.cert_material}">
                                        <img src="{res file=images/cert_material.gif}" />
                                    </a>
                                    <!--{/if}-->
                                    <!--{/foreach}-->
                                </dd>
                            </dl>
                            <!--{/if}-->
                            <!--{if $store.tel}-->
                            <dl style="padding-top:1px;" class="dl-c-s w-full clearfix">
                                <dt>
                                    {$lang.store_add_time}{$lang.colon}
                                </dt>
                                <dd>
                                    {$store.add_time|date}
                                </dd>
                            </dl>
                            <!--{/if}-->
                            <dl style="padding-top:2px;" class="dl-c-s w-full clearfix">
                                <dt>
                                    {$lang.tel}{$lang.colon}
                                </dt>
                                <dd>
                                    {$store.tel|escape}
                                </dd>
                            </dl>
                            <dl style="padding-top:2px;padding-bottom:10px;" class="dl-c-s border-b w-full clearfix">
                                <dt>
                                    {$lang.address}{$lang.colon}
                                </dt>
                                <dd>
                                    {$store.address|escape}
                                </dd>
                            </dl>
                            <div class="go2store">
                                <a href="{url app=store&id=$store.store_id}">
                                    {$lang.go2store}
                                </a>
                                <a href="javascript:collect_store({$store.store_id})">
                                    {$lang.collect_the_store}
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>